package com.wanmait.employment.manageController;

import com.github.pagehelper.PageInfo;
import com.wanmait.employment.entity.CompanyJobHoursBasice;
import com.wanmait.employment.service.CompanyJobHoursBasiceService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/manage/CompanyJobHoursBasice")
@CrossOrigin
public class CompanyJobHoursBasiceController {
    @Resource
    private CompanyJobHoursBasiceService companyJobHoursBasiceService;

    @GetMapping("list")
    @ResponseBody
    public AjaxResult List(String title, Integer pageNum, Integer pageSize){
        PageInfo<CompanyJobHoursBasice> companyJobHoursBasice=companyJobHoursBasiceService.selectList(title,pageNum,pageSize);
        return AjaxResult.success("",companyJobHoursBasice);
    }

    @PostMapping("update")
    public AjaxResult update(@RequestBody CompanyJobHoursBasice companyJobHoursBasice){
        if (companyJobHoursBasice.getId()!=null){
            companyJobHoursBasiceService.update(companyJobHoursBasice);
            return AjaxResult.success("修改成功");
        }
        else {
            companyJobHoursBasiceService.insert(companyJobHoursBasice);
            return AjaxResult.success("添加成功");
        }
    }
    @GetMapping("delete")
    public AjaxResult delete(Integer id){
        companyJobHoursBasiceService.delete(id);
        return  AjaxResult.success("删除成功");
    }

}